<?php
	$TEMP->set_file(array('handle' => DIR_VIEW_DEAN . 'checklistHeader.html'));
	
	$courseDesc 		= $DSC->getListCourses($strAccDept);
	
	$getDepartment 		= $DSC->getDepartment($strAccDept);
	$deptDesc 			= $getDepartment['dept_desc'];
	
	if ( !empty($courseDesc) ) {
		$courseDescOption = '';
		foreach($courseDesc as $courseDescVal) {
			$courseDescOption .= '<option class="checklist-course-option">' . $courseDescVal['course_desc'] . ' (' . $courseDescVal['course_code'] . ')</option>';
		}
	}
	
	if ( isset($_POST['subButton']) ) {
		
		$headID		= _POST('headID');
		$txtbased	= _POST('txtbased');

		$strArray = array('head_idPK' 	=> $headID,
						  'head_year' 	=> $activeYear,
						  'head_based'	=> $txtbased,
						  'dept_idFK'	=> $strAccDept);

		$headID = $DSC->insertUpdateCheckListHeader($strArray);
		$saved_record = "Record Saved.";

	}
	else {
		
		$getChecklistHeader = $DSC->getChecklistHeader($strAccDept, $activeYear);
		$headID	 		= $getChecklistHeader['head_idPK'];
		$txtbased 		= $getChecklistHeader['head_based'];
		$txtyear	 	= $getChecklistHeader['head_year'];
	}
	
	
	$TEMP->set_var(array('dean_sub_menu'	=> $pageLib->deanSubMenu(DIR_IMAGES),
						 'course_desc' 		=> $courseDescOption,
						 'dept_desc' 		=> $deptDesc,
						 'txtbased' 		=> $txtbased,
						 'txtyear' 			=> $txtyear,
						 'headID' 			=> $headID,
						 'saved_record' 	=> $saved_record
						));
?>